<?php

class Core_Backend_Component_Promotion_View_Concessions_Category_Index extends Core_Backend_Share_View_Grid {

    protected function buildToolbar($toolbar) {
    	parent::buildToolbar($toolbar);
    	$group = $toolbar->createGroup();
        $group->addLink($this->getUrl(NULL, 'category-create'), $this->__('share.button.create'));
    }

    protected function buildGrid($grid) {
        $grid->setId('concessions_grid')->setPrimaryKey('id');
        $grid->addLabelColumn($this->__('share.label.name'), 'name', '{name}');
        $grid->addLinkColumn('#', 'edit', $this->getUrl(array('id' => '{id}'), 'category-edit'), $this->__('share.button.edit'))
                ->setWidth(40)
                ->setAlign('center');
        $grid->setDataSource($this->getList()->toArray());
        parent::buildGrid($grid);
    }

    protected function buildPagination($pagination) {
        parent::buildPagination($pagination);
        $pagination->setUrlFormat($this->getPaginationUrl())
                ->setRecordCount($this->getRecords());
    }
}